﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication8
{
    class Program
    {
        static void Main(string[] args)
        {
            string choice = "n";
            do
            {
                Console.Clear();
                Console.WriteLine("Choose your operation:");
                int operation = Int32.Parse(Console.ReadLine());
                switch (operation)
                {
                    case 1:
                        CountNumberInConsole();
                        break;
                    case 2:
                        PrintNumbersFiveToConsole();
                        break;
                    case 3:
                        CountNum();
                        break;
                    case 4:
                        PrintSquad();
                        break;
                    case 5:
                        PrintMax();
                        break;
                    case 6:
                        CountCloneAmeba();
                        break;
                    case 7:
                        CountProcent();
                        break;
                    case 8:
                        PrintRowNumbers();
                        break;
                    case 9:
                        ReverseNumber();
                        break;
                    default:
                        Console.WriteLine("You make wrong choice");
                        break;
                }
                Console.WriteLine();
                Console.WriteLine("You want continue: y/n");
                choice = Console.ReadLine();
            }
            while (choice == "y");
            
        }

        static void CountNumberInConsole()
        {
            int plus = 0;
            int minus = 0;
            int zero = 0;
            Console.WriteLine("Enter count numbers");
            int count = Int32.Parse(Console.ReadLine());
            Console.WriteLine("Enter numbers");
            for (; count > 0; count--)
            {
                int number = Int32.Parse(Console.ReadLine());
                if (number > 0)
                {
                    plus++;
                }
                else if (number < 0)
                {
                    zero++;
                }
                else minus++;     
            }
            Console.WriteLine("Количество положительных чисел:" + plus);
            Console.WriteLine("Количество отрицательных чисел:" + minus);
            Console.WriteLine("Количество нулей:" + zero);
                      
        }

        static void PrintNumbersFiveToConsole()
        {
           
            for ( int number = 99; number >= -99; number--)
            {
                if ((number%5 == 0) && ((number <= -10) || (number >= 10)))
                {
                    Console.WriteLine(number);
                }
            }
        }

        static void CountNum()
        {
            Console.WriteLine("Enter number");
            int number = Int32.Parse(Console.ReadLine());
            int count = 1;
            int max = Int32.MinValue;
            int min = 9;
            int mid = 0;
            while (number/10 > 0)
            {
                mid = number % 10;
                if (max < mid)
                    max = mid;
                if (mid < min)
                    min = mid;
                number /= 10;
                count ++; 
            }
            if (max < number)
                max = number;
            if (number < min)
                min = number;
            Console.WriteLine(count);
            Console.WriteLine(max);
            Console.WriteLine(min);
        }
        static void PrintSquad()
        {
            int squad =2;
            for (int number = 10; number <= 20; number++)
            {
                Console.WriteLine(Math.Pow(number, squad));
                //squad = number * number;
                //Console.WriteLine(squad);
            }
        }
        static void PrintMax()
        {
            int max = Int32.MinValue;
            bool firstIteration = true;
            Console.WriteLine("Enter numbers");
            for (int i = 5; i > 0; i--)
            {
                int number = Int32.Parse(Console.ReadLine());
                if (firstIteration)
                {
                    max = number;
                    firstIteration = false;
                }
                else if (max < number)
                {
                    max = number;
                }
            }
            Console.WriteLine("Maximum value: " + max);
        }
        static void CountCloneAmeba()
        {
            int countameba = 1;
            for ( int hour = 3; hour <= 24; hour = hour + 3)
            {
                countameba *= 2;
                Console.WriteLine("Количество амеб через " + hour + " часов равно " + countameba);
            }
         }
        static void CountProcent()
        {
            Console.WriteLine("Введите начальное количество денег:");
            double money = Int32.Parse(Console.ReadLine());
            Console.WriteLine("Укажите срок вклада, в годах:");
            int year = Int32.Parse(Console.ReadLine());
            for (int i = 0; i <= year; i++)
            {
                double procent = money * 0.03;
                money += procent;
            }
            Console.WriteLine("Ваш вклад после " + year + " лет будет составлять" + Math.Round(money, 2));
        }
        static void PrintRowNumbers()
        {
            for ( int number = 20; number <= 50; number++)
            {
                if (number % 3 == 0 && number % 5 != 0)
                {
                    Console.WriteLine(number);
                }
            }
        }
        static void ReverseNumber()
        {
            Console.WriteLine("Введите число:");
            int reverse = Int32.Parse(Console.ReadLine());
            int a = 0;
            while (reverse != 0)
            {
                Console.Write(reverse%10);
                a = reverse % 10 *10;

                reverse /= 10;
            }
            Console.WriteLine("Обратное число:", a);
        }

    }
}
